//
//  MenuViewController.m
//  MusicPC
//
//  Created by PengchengWang on 16/2/24.
//  Copyright © 2016年 pengchengWang. All rights reserved.
//

#import "MenuViewController.h"
#import "AppDelegate.h"
#import "MusicViewController.h"
#import "ReadViewController.h"

@interface MenuViewController ()

@end

@implementation MenuViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    UIButton *btnMusic = [UIButton buttonWithType:UIButtonTypeSystem];
    btnMusic.frame = CGRectMake(50, 200, 100, 50);
    [btnMusic setTitle:@"音乐" forState:(UIControlStateNormal)];
    [btnMusic addTarget:self action:@selector(musicAction) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:btnMusic];
    
    UIButton *btnRead = [UIButton buttonWithType:UIButtonTypeSystem];
    btnRead.frame = CGRectMake(50, 300, 100, 50);
    [btnRead setTitle:@"阅读" forState:(UIControlStateNormal)];
    [btnRead addTarget:self action:@selector(readAction) forControlEvents:(UIControlEventTouchUpInside)];
    [self.view addSubview:btnRead];
    
    // Do any additional setup after loading the view.
}

-(void)musicAction{
//设置根视图控制器
    MusicViewController *music = [MusicViewController new];
    UINavigationController *music_na = [[UINavigationController alloc] initWithRootViewController:music];
    AppDelegate *app = [UIApplication sharedApplication].delegate;
    [app.draw setRootViewController:music_na];
    
}

-(void)readAction{
//设置根视图控制器
    ReadViewController *read = [ReadViewController new];
    UINavigationController *read_na = [[UINavigationController alloc] initWithRootViewController:read];
    AppDelegate *app = [UIApplication sharedApplication].delegate;
    [app.draw setRootViewController:read_na];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
